@extends('layouts.default') @section('main')
<link rel="stylesheet" href="/css/uniform.css" />
<link rel="stylesheet" href="/css/select2.css" />
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="{{url('role/index')}}"
				class="tip-bottom">角色管理</a> <a href="#" class="current">角色分配</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<form action="{{url('role/assign')}}" method="post" id="roleForm">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"><i class="icon-th"></i></span>
						<h5>角色分配</h5>
					</div>
					<div class="widget-content">
						<table class="table table-bordered table-striped with-check">
							<thead>
								<tr>
									<th></th>
									<th>角色名称</th>
								</tr>
							</thead>
							<tbody>
								@foreach($roles as $key => $role)
								<tr>
									<td><input type="checkbox" name="rid[]" value="{{$role->id}}" {{$role->got}} /></td>
									<td>{{$role->name}}</td>
								</tr>
								@endforeach
							</tbody>
						</table>
					</div>
				</div>
				<input type="hidden" name="_token" value="{{ csrf_token() }}">
				<input type="hidden" name="uid" value="{{$uid}}">
				<button class="btn" type="button" id="doSave">提交</button>
			</div>
			</form>
		</div>
	</div>
</div>
<script src="/js/jquery.min.js"></script>
<script src="/js/matrix.tables.js"></script>
<script src="/js/jquery.min.js"></script> 
<script src="/js/common.js"></script> 
<script>
$("#doSave").click(function(){
	ajaxRequest($('#roleForm').serializeArray(),$('#roleForm').attr('action'),function(data){
		if(data.status){
			window.location.href = data.forwardUrl;
		}else{
			alert(data.message);
		}
	});
});
</script>
@stop
